package com.qijian.business.domain.vo.listVo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.tool.domain.Storage;
import lombok.Data;
import lombok.ToString;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;

/**
 * 销售订单生产进度
 *
 * @author qijian
 * @date 2022-07-19
 */

@Data
@ToString
public class ContractSalesReportVo {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private Long detailId;

    private String projectNo;
    private String projectMachineNo;

    private String number;
    private String billNumber;
    private String name;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;
    private String customerName;
    private String salesmanName;
    private String currencyType;
    private Date signDate;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long itemId;
    private String itemName;
    private BigDecimal productionSchedule;
    private Integer completionQuantity;
    private Integer deliveredQuantity;
    private BigDecimal timelyDeliveryRate;
    private BigDecimal collectionRate;
    private BigDecimal marginalRate;
    private BigDecimal actualMarginalRate;
    private BigDecimal afterSaleFee;
    private BigDecimal quantity;
    private Integer machineQuantity;
    private String machineFids;
    private String completionFids;
    private String deliveredFids;
    private BigDecimal totalAmount;
    private String detailIds;
    private String projectNos;
    private String machineNos;
    private String url;
    private Integer oaCnt;
    // 平均实际的检验进度
    private BigDecimal avgActualQualityRate;

    //交付延迟/提前天数,替换之前的timelyDeliveryRate 字段
    private Integer timelyRateDays;

    private List<Storage> files;

    public BigDecimal getProductionSchedule() {
        return productionSchedule == null ? null : productionSchedule.setScale(2, RoundingMode.CEILING);
    }

    public BigDecimal getTimelyDeliveryRate() {
        return timelyDeliveryRate == null ? null : timelyDeliveryRate.setScale(2, RoundingMode.CEILING);
    }

    public BigDecimal getCollectionRate() {
        return collectionRate == null ? null : collectionRate.setScale(2, RoundingMode.CEILING);
    }

    public BigDecimal getActualMarginalRate() {
        return actualMarginalRate == null ? null : actualMarginalRate.setScale(2, RoundingMode.CEILING);
    }
}
